def setUp(self): super(TestSearchRegistrations, self).setUp() self.url = '/{}search/registrations/'.format(API_BASE) ensure_schemas() self.schema = MetaSchema.find_one( Q('name', 'eq', 'Replication Recipe (Brandt et al., 2013): Post-Completion') & Q('schema_version', 'eq', LATEST_SCHEMA_VERSION)) with mock_archive(self.project, autocomplete=True, autoapprove=True, schema=self.schema) as registration: self.registration = registration with mock_archive(self.project_two, autocomplete=True, autoapprove=True, schema=self.schema) as registration_two: self.registration_two = registration_two with mock_archive(self.private_project, autocomplete=True, autoapprove=True, schema=self.schema) as private_registration: self.private_registration = private_registration self.private_registration.is_public = False self.private_registration.save() # TODO: This shouldn't be necessary, but tests fail if we don't do this. Investigate further. self.private_registration.update_search()
def registration_private(self, project_private, schema): with mock_archive(project_private, autocomplete=True, autoapprove=True, schema=schema) as registration_private: registration_private.is_public = False registration_private.save() # TODO: This shouldn't be necessary, but tests fail if we don't do # this. Investigate further. registration_private.update_search() return registration_private
def setUp(self): super(TestSearchRegistrations, self).setUp() self.url = '/{}search/registrations/'.format(API_BASE) self.schema = MetaSchema.find_one( Q('name', 'eq', 'Replication Recipe (Brandt et al., 2013): Post-Completion') & Q('schema_version', 'eq', LATEST_SCHEMA_VERSION) ) with mock_archive(self.project, autocomplete=True, autoapprove=True, schema=self.schema) as registration: self.registration = registration with mock_archive(self.project_two, autocomplete=True, autoapprove=True, schema=self.schema) as registration_two: self.registration_two = registration_two with mock_archive(self.private_project, autocomplete=True, autoapprove=True, schema=self.schema) as private_registration: self.private_registration = private_registration self.private_registration.is_public = False self.private_registration.save() # TODO: This shouldn't be necessary, but tests fail if we don't do this. Investigate further. self.private_registration.update_search()
def registration_public(self, project_public, schema): with mock_archive(project_public, autocomplete=True, autoapprove=True, schema=schema) as registration_public: return registration_public
def registration(self, project, schema): with mock_archive(project, autocomplete=True, autoapprove=True, schema=schema) as registration: return registration
def registration(self, node): with mock_archive(node, embargo=True, autoapprove=True) as registration: yield registration
def registration(self, project, contributor_unregistered, contributor_unregistered_no_email): with mock_archive(project, autoapprove=True) as registration: return registration