def test_organizations_view_without_permission(self):
        """ Unregistered users can see organizations."""
        # again, not sure why you have to call this explicitly
        assign_user_policies(None, Policy.objects.get(name='default'))
        page = OrganizationListPage(self)
        page.go_to()

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #0'
    def test_organizations_view_with_permission(self):
        """A registered user can view organizations"""

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

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #0'
    def test_organizations_view_with_permission(self):
        """A registered user can view organizations"""

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

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #0'
    def test_organizations_view_without_permission(self):
        """ Unregistered users can see organizations."""
        # again, not sure why you have to call this explicitly
        assign_user_policies(None, Policy.objects.get(name='default'))
        page = OrganizationListPage(self)
        page.go_to()

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #0'
    def test_searching_for_organizations(self):
        """A registered user user can search for organization by name."""

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

        search = page.get_search_box()
        search.send_keys("#1")

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #1'
Beispiel #6
0
    def test_admin_creation_when_adding_organization(self):
        """A user that can create a new organization and
        is automatically made an admin."""

        LoginPage(self).login('testuser', 'password')
        page = OrganizationMemberPage(self)
        page.go_to()

        OrganizationListPage(self).click_add_button()
        fields = OrganizationListPage(self).get_fields()
        fields['name'].send_keys('Organization #2')
        fields['description'].send_keys('This is a test organization')
        OrganizationListPage(self).click_submit_button()

        OrganizationMemberListPage(self).go_to_member_list_page()
        page.go_to_testuser_member_page()

        roles = page.get_role_options()
        assert roles['selected'].text == "Administrator"
    def test_searching_for_organizations(self):
        """A registered user user can search for organization by name."""

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

        search = page.get_search_box()
        search.send_keys("#1")

        organization_title = page.get_organization_title_in_table()
        assert organization_title == 'Organization #1'
    def test_sorting_organization_view(self):
        """A registered user user can sort the organization list
        by id, name, and number of projects."""

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

        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Organization #1'

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

        first_org = page.sort_table_by("ascending", col="project")
        assert first_org == 'Organization #1'

        first_org = page.sort_table_by("descending", col="project")
        assert first_org == 'Organization #0'
    def test_sorting_organization_view(self):
        """A registered user user can sort the organization list
        by id, name, and number of projects."""

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

        first_org = page.sort_table_by("descending", col="organization")
        assert first_org == 'Organization #1'

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

        first_org = page.sort_table_by("ascending", col="project")
        assert first_org == 'Organization #1'

        first_org = page.sort_table_by("descending", col="project")
        assert first_org == 'Organization #0'
    def test_adding_an_organization(self):
        """A registered user can add an organization
        and this organization if visible to other users."""

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

        page.click_add_button()
        page.try_cancel_and_close()

        fields = page.get_fields()
        page.try_submit(err=['name'], ok=['description', 'urls'])

        fields = page.get_fields()
        fields['name'].send_keys('Organization #2')
        fields['description'].send_keys('This is a test organization')
        fields['urls'].send_keys('invalid url')
        page.try_submit(err=['urls'],
                        ok=['name', 'description'],
                        message='This value should be a valid url.')

        fields = page.get_fields()
        fields['urls'].clear()

        page.click_submit_button()
        organization_name = self.page_title().text
        assert organization_name == 'Organization #2'.upper()
        self.logout()

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

        organization_table = page.get_new_organization_title_in_table()
        assert "Organization #2" in organization_table
    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_adding_an_organization(self):
        """A registered user can add an organization
        and this organization if visible to other users."""

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

        page.click_add_button()
        page.try_cancel_and_close()

        fields = page.get_fields()
        page.try_submit(err=['name'], ok=['description', 'urls'])

        fields = page.get_fields()
        fields['name'].send_keys('Organization #2')
        fields['description'].send_keys('This is a test organization')
        fields['urls'].send_keys('invalid url')
        page.try_submit(err=['urls'], ok=['name', 'description'],
                        message='This value should be a valid url.')

        fields = page.get_fields()
        fields['urls'].clear()

        page.click_submit_button()
        organization_name = self.page_title().text
        assert organization_name == 'Organization #2'.upper()
        self.logout()

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

        organization_table = page.get_new_organization_title_in_table()
        assert "Organization #2" in organization_table
    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'