コード例 #1
0
def test_group_join_group(tmpdir: LocalPath, setup: SetupTest,
                          browser: Chrome) -> None:
    with setup.transaction():
        setup.add_user_to_group("*****@*****.**", "some-group", "owner")
        setup.create_group("parent-group",
                           join_policy=GroupJoinPolicy.CAN_JOIN)

    with frontend_server(tmpdir, "*****@*****.**") as frontend_url:
        browser.get(url(frontend_url, "/groups/parent-group/join"))
        join_page = GroupJoinPage(browser)

        join_page.set_member("some-group")
        join_page.set_reason("Testing")
        join_page.submit()

        group_page = GroupViewPage(browser)
        assert group_page.find_member_row("some-group")
コード例 #2
0
def test_group_join_group_as_owner(tmpdir: LocalPath, setup: SetupTest,
                                   browser: Chrome) -> None:
    with setup.transaction():
        setup.add_user_to_group("*****@*****.**", "some-group", "owner")
        setup.create_group("parent-group",
                           join_policy=GroupJoinPolicy.CAN_JOIN)

    with frontend_server(tmpdir, "*****@*****.**") as frontend_url:
        browser.get(url(frontend_url, "/groups/parent-group/join"))
        join_page = GroupJoinPage(browser)

        join_page.set_member("some-group")
        join_page.set_reason("Testing")
        for role in ("Manager", "Owner", "Np-Owner"):
            join_page.set_role(role)
            join_page.submit()
            assert join_page.has_alert(
                "Groups can only have the role of 'member'")