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'
    def test_archived_orgs_appear_for_admin_user(self):
        """The option to filter active/archived organizations is available to
        organization administrators."""

        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_appear_for_admin_user(self):
        """The option to filter active/archived organizations is available to
        organization administrators."""

        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'