Esempio n. 1
0
async def test_workspace_button_shared_with(qtbot, workspace_fs, core_config,
                                            bob):
    switch_language(core_config, "en")

    roles = {
        bob.user_id: WorkspaceRole.READER,
        workspace_fs.device.user_id: WorkspaceRole.OWNER
    }
    w = WorkspaceButton(
        workspace_name="Workspace",
        workspace_fs=workspace_fs,
        users_roles=roles,
        is_mounted=True,
        files=[],
    )

    qtbot.addWidget(w)
    w.show()
    assert w.widget_empty.isVisible() is True
    assert w.widget_files.isVisible() is False
    assert w.label_owner.isVisible() is True
    assert w.label_shared.isVisible() is True
    assert w.name == "Workspace"
    assert w.label_title.text().startswith("Workspace")
    assert w.label_title.toolTip() == "Workspace (shared with bob)"
async def test_workspace_button_owned_by(qtbot, workspace_fs, core_config, bob,
                                         alice_user_info, bob_user_info):
    switch_language(core_config, "en")

    roles = {
        bob.user_id: (WorkspaceRole.OWNER, bob_user_info),
        alice_user_info.user_id: (WorkspaceRole.READER, alice_user_info),
    }
    w = WorkspaceButton(
        workspace_name="Workspace",
        workspace_fs=workspace_fs,
        users_roles=roles,
        is_mounted=True,
        files=[],
    )

    qtbot.addWidget(w)
    w.show()
    assert w.widget_empty.isVisible() is True
    assert w.widget_files.isVisible() is False
    assert w.label_owner.isVisible() is False
    assert w.label_shared.isVisible() is True
    assert w.name == "Workspace"
    assert w.label_title.text().startswith("Workspace")
    assert w.label_title.toolTip() == "Workspace (owned by Boby McBobFace)"
    assert w.label_role.text() == _("TEXT_WORKSPACE_ROLE_READER")
Esempio n. 3
0
async def test_workspace_button_shared_by(qtbot, workspace_fs, core_config):
    switch_language(core_config, "en")

    w = WorkspaceButton(
        workspace_name="Workspace",
        workspace_fs=workspace_fs,
        is_shared=True,
        is_creator=False,
        files=[],
    )

    qtbot.addWidget(w)
    w.show()
    assert w.widget_empty.isVisible() is True
    assert w.widget_files.isVisible() is False
    assert w.label_owner.isVisible() is False
    assert w.label_shared.isVisible() is True
    assert w.name == "Workspace"
    assert w.label_title.text() == "Workspace"
Esempio n. 4
0
async def test_workspace_button_files(qtbot, workspace_fs, core_config):
    switch_language(core_config, "en")

    roles = {workspace_fs.device.user_id: WorkspaceRole.OWNER}
    w = WorkspaceButton(
        workspace_name="Workspace",
        workspace_fs=workspace_fs,
        users_roles=roles,
        is_mounted=True,
        files=["File1.txt", "File2.txt", "Dir1"],
    )

    qtbot.addWidget(w)
    w.show()
    assert w.widget_empty.isVisible() is False
    assert w.widget_files.isVisible() is True
    assert w.label_owner.isVisible() is True
    assert w.label_shared.isVisible() is False
    assert w.name == "Workspace"
    assert w.file1_name.text() == "File1.txt"
    assert w.file2_name.text() == "File2.txt"
    assert w.file3_name.text() == "Dir1"
    assert w.file4_name.text() == ""
Esempio n. 5
0
async def test_workspace_button_files(qtbot, workspace_fs, core_config):
    switch_language(core_config, "en")

    w = WorkspaceButton(
        workspace_name="Workspace",
        workspace_fs=workspace_fs,
        is_shared=True,
        is_creator=True,
        files=["File1.txt", "File2.txt", "Dir1"],
    )

    qtbot.addWidget(w)
    w.show()
    assert w.widget_empty.isVisible() is False
    assert w.widget_files.isVisible() is True
    assert w.label_owner.isVisible() is True
    assert w.label_shared.isVisible() is True
    assert w.name == "Workspace"
    assert w.label_title.text() == "Workspace (shared wi..."
    assert w.label_title.toolTip()
    assert w.file1_name.text() == "File1.txt"
    assert w.file2_name.text() == "File2.txt"
    assert w.file3_name.text() == "Dir1"
    assert w.file4_name.text() == ""