Exemplo n.º 1
0
def test_should_fail_in_drives_files_create(
    mk_cli_anon: Misskey
):
    with pytest.raises(MisskeyAPIException):
        with open('tests/test_image.png', mode='rb') as f:
            mk_cli_anon.drive_files_create(
                f,
            )
Exemplo n.º 2
0
def test_drive_files(
    mk_cli_admin: Misskey
):
    with open('tests/test_image.png', mode='rb') as f:
        res_create = mk_cli_admin.drive_files_create(
            f,
        )
        assert type(res_create) == dict

        res_file_check = mk_cli_admin.drive_files_check_existence(
            res_create['md5'],
        )
        assert type(res_file_check) == bool
        assert res_file_check

        res_find_hash = mk_cli_admin.drive_files_find_by_hash(
            res_create['md5'],
        )
        assert type(res_find_hash) == list

        res_attached_notes = mk_cli_admin.drive_files_attached_notes(
            res_create['id'],
        )
        assert type(res_attached_notes) == list

        res_files_show = mk_cli_admin.drive_files_show(
            res_create['id'],
        )
        assert type(res_files_show) == dict

        res_files_update = mk_cli_admin.drive_files_update(
            res_create['id'],
            folder_id=None,
            comment='test file',
        )
        assert type(res_files_update) == dict

        res_delete = mk_cli_admin.drive_files_delete(
            res_create['id'],
        )
        assert type(res_delete) == bool
        assert res_delete