Skip to content

Commit

Permalink
feature/add-consent-field-to-contact-serializer (#5923)
Browse files Browse the repository at this point in the history
* Add consent_data_last_modified to contact serializer

* linting fix
  • Loading branch information
chopkinsmade authored Jan 27, 2025
1 parent a29e3af commit 0c8bd2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions datahub/company/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ class Meta:
'modified_on',
'address_area',
'consent_data',
'consent_data_last_modified',
'consent_data_management_url',
)
read_only_fields = (
'archived_documents_url_path',
'consent_data',
'consent_data_last_modified',
'consent_data_management_url',
)
validators = [
Expand Down
9 changes: 8 additions & 1 deletion datahub/company/test/test_contact_views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import date
from datetime import date, datetime

import factory
import pytest
Expand Down Expand Up @@ -149,6 +149,7 @@ def test_with_manual_address(self, get_consent_fixture):
'modified_on': '2017-04-18T13:25:30.986208Z',
'valid_email': None,
'consent_data': None,
'consent_data_last_modified': None,
'consent_data_management_url': None,
}

Expand Down Expand Up @@ -466,6 +467,7 @@ def test_with_us_manual_address(self, get_consent_fixture):
'modified_on': '2017-04-18T13:25:30.986208Z',
'valid_email': True,
'consent_data': None,
'consent_data_last_modified': None,
'consent_data_management_url': 'http://domain.com/?email=foo@bar.com',
}

Expand Down Expand Up @@ -589,6 +591,7 @@ def test_patch(self):
'modified_on': '2017-04-19T13:25:30.986208Z',
'valid_email': True,
'consent_data': None,
'consent_data_last_modified': None,
'consent_data_management_url': 'http://domain.com/?email=foo@bar.com',
}

Expand Down Expand Up @@ -790,6 +793,7 @@ def test_patch_area(self):
'modified_on': '2017-04-19T13:25:30.986208Z',
'valid_email': True,
'consent_data': None,
'consent_data_last_modified': None,
'consent_data_management_url': 'http://domain.com/?email=foo@bar.com',
}

Expand Down Expand Up @@ -929,6 +933,7 @@ def test_view(self):
notes='lorem ipsum',
valid_email=True,
consent_data={'consent': True},
consent_data_last_modified=datetime.now(),
)
url = reverse(f'{self.endpoint_namespace}:contact:detail', kwargs={'pk': contact.pk})
response = self.api_client.get(url)
Expand Down Expand Up @@ -982,6 +987,7 @@ def test_view(self):
'modified_on': '2017-04-18T13:25:30.986208Z',
'valid_email': True,
'consent_data': {'consent': True},
'consent_data_last_modified': '2017-04-18T13:25:30.986208Z',
'consent_data_management_url': 'http://domain.com/?email=foo@bar.com',
}

Expand Down Expand Up @@ -1216,6 +1222,7 @@ def test_all_details(self):
},
'valid_email': True,
'consent_data': {'consent': False},
'consent_data_last_modified': None,
'consent_data_management_url': 'http://domain.com/?email=foo@bar.com',
},
],
Expand Down

0 comments on commit 0c8bd2e

Please sign in to comment.