def test_it_returns_links_property(self, factories, pyramid_request): organization = factories.Organization() organization_context = OrganizationContext(organization, pyramid_request) assert organization_context.links == {}
def test_it_returns_pubid_as_id(self, factories, pyramid_request): organization = factories.Organization() organization_context = OrganizationContext(organization, pyramid_request) assert organization_context.id != organization.id assert organization_context.id == organization.pubid
def test_default_property_if_default_organization(self, factories, pyramid_request): organization = Organization.default(pyramid_request.db) organization_context = OrganizationContext(organization, pyramid_request) assert organization_context.default is True
def test_default_property_if_not_default_organization( self, factories, pyramid_request): organization = factories.Organization() organization_context = OrganizationContext(organization, pyramid_request) assert organization_context.default is False
def test_it_returns_organization_model_as_property(self, factories, pyramid_request): organization = factories.Organization() organization_context = OrganizationContext(organization, pyramid_request) assert organization_context.organization == organization
def test_it_returns_none_for_logo_if_no_logo(self, factories, pyramid_request): pyramid_request.route_url = mock.Mock() organization = factories.Organization(logo=None) organization_context = OrganizationContext(organization, pyramid_request) logo = organization_context.logo pyramid_request.route_url.assert_not_called assert logo is None
def test_it_returns_logo_property_as_route_url(self, factories, pyramid_request): fake_logo = '<svg>H</svg>' pyramid_request.route_url = mock.Mock() organization = factories.Organization(logo=fake_logo) organization_context = OrganizationContext(organization, pyramid_request) logo = organization_context.logo pyramid_request.route_url.assert_called_with('organization_logo', pubid=organization.pubid) assert logo is not None