Esempio n. 1
0
    def test_organization_is_None_if_the_group_has_no_organization(
            self, factories, pyramid_request):
        group = factories.Group()

        group_context = GroupContext(group, pyramid_request)

        assert group_context.organization is None
Esempio n. 2
0
    def test_it_proxies_links_to_svc(self, factories, links_svc,
                                     pyramid_request):
        group = factories.Group()

        group_context = GroupContext(group, pyramid_request)

        assert group_context.links == links_svc.get_all.return_value
Esempio n. 3
0
    def test_it_returns_group_model_as_property(self, factories,
                                                pyramid_request):
        group = factories.Group()

        group_context = GroupContext(group, pyramid_request)

        assert group_context.group == group
Esempio n. 4
0
    def test_it_returns_None_for_missing_organization_relation(
            self, factories, pyramid_request):
        group = factories.Group()
        group.organization = None

        group_context = GroupContext(group, pyramid_request)

        assert group_context.organization is None
Esempio n. 5
0
    def test_it_expands_organization_if_the_group_has_one(
            self, factories, pyramid_request):
        organization = factories.Organization()
        group = factories.Group(organization=organization)

        group_context = GroupContext(group, pyramid_request)

        assert group_context.organization.organization == organization
Esempio n. 6
0
    def test_it_returns_pubid_as_id(self, factories, pyramid_request):
        group = factories.Group()

        group_context = GroupContext(group, pyramid_request)

        assert group_context.id == group.pubid  # NOT the group.id
Esempio n. 7
0
    def test_it_expands_organization(self, factories, pyramid_request):
        group = factories.Group()

        group_context = GroupContext(group, pyramid_request)

        assert isinstance(group_context.organization, OrganizationContext)