def __init__(self, group, request): super(GroupSearchController, self).__init__(request) self.group = group if group.organization: self._organization_context = OrganizationContext( group.organization, request) else: self._organization_context = None
def test_default_organization(self, db_session, routes, pyramid_request): organization = Organization.default(db_session) organization_context = OrganizationContext(organization, pyramid_request) presenter = OrganizationJSONPresenter(organization_context) presented = presenter.asdict() assert presented['default'] is True
def test_organization_asdict_with_logo(self, factories, routes, pyramid_request): organization = factories.Organization(name='My Org', logo='<svg>H</svg>') organization_context = OrganizationContext(organization, pyramid_request) presenter = OrganizationJSONPresenter(organization_context) assert presenter.asdict() == { 'name': 'My Org', 'id': organization_context.id, 'default': False, 'logo': pyramid_request.route_url('organization_logo', pubid=organization.pubid) }
def test_organization_asdict_no_logo(self, factories, pyramid_request): organization = factories.Organization(name='My Org', logo=None) organization_context = OrganizationContext(organization, pyramid_request) presenter = OrganizationJSONPresenter(organization_context) assert presenter.asdict() == { 'name': 'My Org', 'id': organization.pubid, 'default': False, 'logo': None, }
def test_organization_asdict_no_logo(self, factories, pyramid_request): organization = factories.Organization(name="My Org", logo=None) organization_context = OrganizationContext(organization, pyramid_request) presenter = OrganizationJSONPresenter(organization_context) assert presenter.asdict() == { "name": "My Org", "id": organization.pubid, "default": False, "logo": None, }
def test_organization_asdict_with_logo(self, factories, routes, pyramid_request): organization = factories.Organization(name="My Org", logo="<svg>H</svg>") organization_context = OrganizationContext(organization, pyramid_request) presenter = OrganizationJSONPresenter(organization_context) assert presenter.asdict() == { "name": "My Org", "id": organization_context.id, "default": False, "logo": pyramid_request.route_url("organization_logo", pubid=organization.pubid), }
def get_controller(): organization_context = OrganizationContext( request=pyramid_request, organization=organization) return OrganizationEditController(organization_context, pyramid_request)
def organization_context(self, factories, pyramid_request): return OrganizationContext(factories.Organization(), pyramid_request)
def get_controller(): return OrganizationEditController( OrganizationContext(organization), pyramid_request )
def organization_context(self, factories): return OrganizationContext(factories.Organization())