Esempio n. 1
0
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
Esempio n. 2
0
    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
Esempio n. 3
0
 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)
Esempio n. 4
0
    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
Esempio n. 5
0
 def service(self, db_session):
     return OrganizationService(db_session)