def test_preprint_contributor_changes_updates_preprints_share( self, mock_on_preprint_updated, user, file, auth): preprint = PreprintFactory(is_published=True, creator=user) assert mock_on_preprint_updated.call_count == 2 user2 = AuthUserFactory() preprint.primary_file = file preprint.add_contributor(contributor=user2, auth=auth, save=True) assert mock_on_preprint_updated.call_count == 5 preprint.move_contributor(contributor=user, index=0, auth=auth, save=True) assert mock_on_preprint_updated.call_count == 7 data = [{ 'id': user._id, 'permissions': ADMIN, 'visible': True }, { 'id': user2._id, 'permissions': WRITE, 'visible': False }] preprint.manage_contributors(data, auth=auth, save=True) assert mock_on_preprint_updated.call_count == 9 preprint.update_contributor(user2, READ, True, auth=auth, save=True) assert mock_on_preprint_updated.call_count == 11 preprint.remove_contributor(contributor=user2, auth=auth) assert mock_on_preprint_updated.call_count == 13
def orphaned_preprint(self, orphaned_preprint_node): orphaned_preprint = PreprintFactory(project=orphaned_preprint_node) orphaned_preprint.primary_file = None orphaned_preprint.save() return orphaned_preprint
def orphaned_preprint(self, orphaned_preprint_node): orphaned_preprint = PreprintFactory(project=orphaned_preprint_node) orphaned_preprint.primary_file = None orphaned_preprint.save() return orphaned_preprint