def _maybe_create_default_organization(engine, authority): from h.services.organization import OrganizationService session = Session(bind=engine) default_org = OrganizationService(session).get_default(authority) session.commit() session.close() return default_org
def test_create_private_group_creates_group_with_specified_organization( self, db_session, service): org = OrganizationService(db_session).create( name='My organization', authority='example.com', ) group = service.create_private_group('Anteater fans', 'cazimir', organization=org) assert group.organization == org
def test_create_restricted_group_with_mismatched_authorities_raises_value_error( self, db_session, service, users): creator = users['cazimir'] org = OrganizationService(db_session).create( name='My organization', authority='bar.com', ) with pytest.raises(ValueError): service.create_restricted_group(name='test_group', userid=creator.username, origins=['https://biopub.org'], description='test_description', organization=org)
def test_create_restricted_group_creates_group_with_specified_organization( self, db_session, service, users): creator = users['cazimir'] org = OrganizationService(db_session).create( name='My organization', authority='example.com', ) group = service.create_restricted_group(name='test_group', userid=creator.username, origins=['https://biopub.org'], description='test_description', organization=org) assert group.organization == org
def service(self, db_session): return OrganizationService(db_session)