def test_archived_orgs_filter_appears_in_long_list(self):
        """If the organization list spans two pages, and an archived
        organization appears on the second page, the archive filter option
        should still appear"""
        OrganizationFactory.create_batch(10)

        LoginPage(self).login('testadmin', 'password')
        page = OrganizationListPage(self)
        page.go_to()

        first_org = page.get_organization_title_in_table()
        assert first_org == 'Organization #0'

        page.click_archive_filter("Archived")
        first_org = page.get_organization_title_in_table()
        assert first_org == 'Zealous Archived Organization Archived'

        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Zealous Archived Organization Archived'

        page.sort_table_by("ascending", col="organization")
        page.click_archive_filter("All")
        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Zealous Archived Organization Archived'

        first_org = page.sort_table_by("ascending", col="organization")
        assert first_org == 'Organization #0'

        page.click_archive_filter("Archived")
        page.click_archive_filter("Active")
        first_org = page.get_organization_title_in_table()
        assert first_org == 'Organization #0'
    def test_archived_orgs_filter_appears_in_long_list(self):
        """If the organization list spans two pages, and an archived
        organization appears on the second page, the archive filter option
        should still appear"""
        OrganizationFactory.create_batch(10)

        LoginPage(self).login('testadmin', 'password')
        page = OrganizationListPage(self)
        page.go_to()

        first_org = page.get_organization_title_in_table()
        assert first_org == 'Organization #0'

        page.click_archive_filter("Archived")
        first_org = page.get_organization_title_in_table()
        assert first_org == 'Zealous Archived Organization Archived'

        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Zealous Archived Organization Archived'

        page.sort_table_by("ascending", col="organization")
        page.click_archive_filter("All")
        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Zealous Archived Organization Archived'

        first_org = page.sort_table_by("ascending", col="organization")
        assert first_org == 'Organization #0'

        page.click_archive_filter("Archived")
        page.click_archive_filter("Active")
        first_org = page.get_organization_title_in_table()
        assert first_org == 'Organization #0'
예제 #3
0
    def test_with_organizations_and_projects(self):
        user = UserFactory.create()
        org1, org2 = OrganizationFactory.create_batch(2)

        proj1, proj2 = ProjectFactory.create_batch(2, organization=org1)
        proj3 = ProjectFactory.create(organization=org2)
        proj4 = ProjectFactory.create(organization=org2, archived=False)

        ProjectRole.objects.create(project=proj1, user=user, role='DC')
        is_not_admin_org1 = OrganizationRole.objects.create(organization=org1,
                                                            user=user,
                                                            admin=False).admin
        is_admin_org2 = OrganizationRole.objects.create(organization=org2,
                                                        user=user,
                                                        admin=True).admin

        response = self.request(user=user)

        assert response.status_code == 200
        assert response.content == self.render_content(user_orgs_and_projects=[
            (org1, is_not_admin_org1,
             [(proj2, 'Public User'), (proj1, 'Data Collector')]),
            (org2, is_admin_org2,
             [(proj3, 'Administrator'), (proj4, 'Administrator')]),
        ])