def test_remove_last_owner(async_server, browser): # noqa: F811 fe_url = url(async_server, "/groups/team-sre") browser.get(fe_url) page = GroupViewPage(browser) row = page.find_member_row("*****@*****.**") assert row.role == "owner" row.click_remove_button() modal = page.get_remove_user_modal() modal.confirm() row = page.find_member_row("*****@*****.**") assert row.role == "owner" assert page.has_text(group_ownership_policy.EXCEPTION_MESSAGE)
def test_remove_member(async_server, browser): # noqa: F811 fe_url = url(async_server, "/groups/team-sre") browser.get(fe_url) page = GroupViewPage(browser) row = page.find_member_row("*****@*****.**") assert row.role == "member" row.click_remove_button() modal = page.get_remove_user_modal() modal.confirm() assert page.current_url.endswith("/groups/team-sre?refresh=yes") with pytest.raises(NoSuchElementException): assert page.find_member_row("*****@*****.**")
def test_remove_last_owner(tmpdir: LocalPath, setup: SetupTest, browser: Chrome) -> None: with setup.transaction(): setup.add_user_to_group("*****@*****.**", "team-sre", role="owner") setup.add_user_to_group("*****@*****.**", "admins") setup.grant_permission_to_group(GROUP_ADMIN, "", "admins") with frontend_server(tmpdir, "*****@*****.**") as frontend_url: browser.get(url(frontend_url, "/groups/team-sre")) page = GroupViewPage(browser) row = page.find_member_row("*****@*****.**") assert row.role == "owner" row.click_remove_button() modal = page.get_remove_user_modal() modal.confirm() row = page.find_member_row("*****@*****.**") assert row.role == "owner" assert page.has_alert(group_ownership_policy.EXCEPTION_MESSAGE)
def test_remove_member(tmpdir: LocalPath, setup: SetupTest, browser: Chrome) -> None: with setup.transaction(): setup.add_user_to_group("*****@*****.**", "team-sre", role="owner") setup.add_user_to_group("*****@*****.**", "team-sre") with frontend_server(tmpdir, "*****@*****.**") as frontend_url: browser.get(url(frontend_url, "/groups/team-sre")) page = GroupViewPage(browser) row = page.find_member_row("*****@*****.**") assert row.role == "member" row.click_remove_button() modal = page.get_remove_user_modal() modal.confirm() assert page.current_url.endswith("/groups/team-sre?refresh=yes") with pytest.raises(NoSuchElementException): assert page.find_member_row("*****@*****.**")