diff --git a/api_tests/draft_nodes/views/test_draft_node_detail.py b/api_tests/draft_nodes/views/test_draft_node_detail.py index 5bbbfa5b388a..11369073813d 100644 --- a/api_tests/draft_nodes/views/test_draft_node_detail.py +++ b/api_tests/draft_nodes/views/test_draft_node_detail.py @@ -55,6 +55,7 @@ def test_detail_response(self, app, user, user_two): assert res.status_code == 404 # cannot access draft node after it's been registered (it's now a node!) + draft_reg.title = 'test user generated title.' draft_reg.register(Auth(user)) url = '/{}draft_nodes/{}/'.format(API_BASE, draft_node._id) res = app.get(url, auth=user_two.auth, expect_errors=True) diff --git a/api_tests/draft_registrations/views/test_draft_registration_detail.py b/api_tests/draft_registrations/views/test_draft_registration_detail.py index d7e7626ac132..54ce2250932b 100644 --- a/api_tests/draft_registrations/views/test_draft_registration_detail.py +++ b/api_tests/draft_registrations/views/test_draft_registration_detail.py @@ -95,7 +95,7 @@ def test_detail_view_returns_editable_fields_no_specified_node(self, app, user): res = app.get(url, auth=user.auth, expect_errors=True) attributes = res.json['data']['attributes'] - assert attributes['title'] == 'Untitled' + assert attributes['title'] == '' assert attributes['description'] == '' assert attributes['category'] == '' assert attributes['node_license'] is None diff --git a/api_tests/draft_registrations/views/test_draft_registration_list.py b/api_tests/draft_registrations/views/test_draft_registration_list.py index 509e8daacc2a..c317d8836fcf 100644 --- a/api_tests/draft_registrations/views/test_draft_registration_list.py +++ b/api_tests/draft_registrations/views/test_draft_registration_list.py @@ -394,7 +394,7 @@ def test_draft_registration_attributes_not_copied_from_node(self, app, project_p res = app.post_json_api(url_draft_registrations, payload, auth=user.auth) assert res.status_code == 201 attributes = res.json['data']['attributes'] - assert attributes['title'] == 'Untitled' + assert attributes['title'] == '' assert attributes['description'] != project_public.description assert attributes['category'] != project_public.category assert set(attributes['tags']) != set([tag.name for tag in project_public.tags.all()]) diff --git a/api_tests/registrations/views/test_registration_list.py b/api_tests/registrations/views/test_registration_list.py index 601152b550bb..646bfd333273 100644 --- a/api_tests/registrations/views/test_registration_list.py +++ b/api_tests/registrations/views/test_registration_list.py @@ -1570,6 +1570,9 @@ def test_need_admin_perms_on_draft( payload_ver['data']['attributes']['draft_registration_id'] = draft_registration._id assert draft_registration.branched_from.is_admin_contributor(user) is False assert draft_registration.has_permission(user, permissions.ADMIN) is True + assert draft_registration.title is "" + draft_registration.title = 'test user generated title required' + draft_registration.save() res = app.post_json_api(url_registrations_ver, payload_ver, auth=user.auth) assert res.status_code == 201 @@ -1578,6 +1581,9 @@ def test_need_admin_perms_on_draft( assert draft_registration.branched_from.is_admin_contributor(user) is True assert draft_registration.has_permission(user, permissions.ADMIN) is True payload_ver['data']['attributes']['draft_registration_id'] = draft_registration._id + assert draft_registration.title is "" + draft_registration.title = 'test user generated title required' + draft_registration.save() res = app.post_json_api(url_registrations_ver, payload_ver, auth=user.auth) assert res.status_code == 201 diff --git a/osf/models/mixins.py b/osf/models/mixins.py index bd2ba523deda..99700b567d43 100644 --- a/osf/models/mixins.py +++ b/osf/models/mixins.py @@ -2271,7 +2271,7 @@ def copy_editable_fields(self, resource, auth=None, alternative_resource=None, i TODO, add optional logging parameter """ from osf.models.draft_node import DraftNode - if not isinstance(resource, DraftNode): # Force the user to add there own title. + if not isinstance(resource, DraftNode): # Force the user to add there own title.test_create_draft_registration_without_node self.set_editable_attribute('title', resource, alternative_resource) self.set_editable_attribute('description', resource, alternative_resource) diff --git a/osf_tests/test_draft_node.py b/osf_tests/test_draft_node.py index e8d2ef143244..288fb4c4dd98 100644 --- a/osf_tests/test_draft_node.py +++ b/osf_tests/test_draft_node.py @@ -22,6 +22,7 @@ get_default_metaschema, ) from website.project.signals import after_create_registration +from website import settings pytestmark = pytest.mark.django_db @@ -123,8 +124,8 @@ def test_create_draft_registration_without_node(self, user): schema=get_default_metaschema(), data=data, ) - assert draft.title == 'Untitled' - assert draft.branched_from.title == 'Untitled' + assert draft.title == '' + assert draft.branched_from.title == settings.DEFAULT_DRAFT_NODE_TITLE assert draft.branched_from.type == 'osf.draftnode' assert draft.branched_from.creator == user assert len(draft.logs.all()) == 0 diff --git a/osf_tests/test_draft_registration.py b/osf_tests/test_draft_registration.py index b6133c4e32ab..2527df493e76 100644 --- a/osf_tests/test_draft_registration.py +++ b/osf_tests/test_draft_registration.py @@ -269,7 +269,7 @@ def test_create_from_node_draft_node(self, user): schema=factories.get_default_metaschema(), ) - assert draft.title == 'Untitled' + assert draft.title == '' assert draft.description == '' assert draft.category == '' assert user in draft.contributors.all() diff --git a/website/settings/defaults.py b/website/settings/defaults.py index dac43d2ecae7..137900fd10c6 100644 --- a/website/settings/defaults.py +++ b/website/settings/defaults.py @@ -313,7 +313,6 @@ def parent_dir(path): # Google Analytics GOOGLE_ANALYTICS_ID = None -GOOGLE_TAG_MANAGER_ID = None GOOGLE_SITE_VERIFICATION = None DEFAULT_HMAC_SECRET = 'changeme' @@ -2129,4 +2128,4 @@ def from_node_usage(cls, usage_bytes, private_limit=None, public_limit=None): PREPRINT_METRICS_START_DATE = datetime.datetime(2019, 1, 1) WAFFLE_VALUES_YAML = 'osf/features.yaml' -DEFAULT_DRAFT_NODE_TITLE = 'Untitled' \ No newline at end of file +DEFAULT_DRAFT_NODE_TITLE = 'Untitled'