Exemple #1
0
    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
Exemple #2
0
    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
Exemple #3
0
    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
Exemple #4
0
    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
Exemple #5
0
    def test_it_returns_links_property(self, factories, pyramid_request):
        organization = factories.Organization()

        organization_context = OrganizationContext(organization, pyramid_request)

        assert organization_context.links == {}
Exemple #6
0
    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