Example #1
0
def test_leave_as_last_owner(tmpdir: LocalPath, setup: SetupTest,
                             browser: Chrome) -> None:
    with setup.transaction():
        setup.add_user_to_group("*****@*****.**", "some-group", role="owner")
        setup.add_user_to_group("*****@*****.**", "some-group", role="manager")

    with frontend_server(tmpdir, "*****@*****.**") as frontend_url:
        browser.get(url(frontend_url, "/groups/some-group"))

        view_page = GroupViewPage(browser)
        with pytest.raises(NoSuchElementException):
            view_page.click_leave_button()
Example #2
0
def test_leave(tmpdir: LocalPath, setup: SetupTest, browser: Chrome) -> None:
    with setup.transaction():
        setup.add_user_to_group("*****@*****.**", "some-group")

    with frontend_server(tmpdir, "*****@*****.**") as frontend_url:
        browser.get(url(frontend_url, "/groups/some-group"))

        view_page = GroupViewPage(browser)
        assert view_page.find_member_row("*****@*****.**")
        view_page.click_leave_button()

        leave_page = GroupLeavePage(browser)
        assert leave_page.subheading == "Leave (some-group)"
        leave_page.submit()

        assert browser.current_url.endswith("/groups/some-group?refresh=yes")
        with pytest.raises(NoSuchElementException):
            view_page.find_member_row("*****@*****.**")